#ifndef _CSOUND_H_
#define _CSOUND_H_

/// Include files
#include "bass.h"
#include <map>
#include <iterator>
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include "windows.h"

using namespace std;

#pragma comment (lib, "Bass.lib")

namespace Framework
{
	typedef enum {
		STR_MP123_OGG_WAV_AIFF,
		STR_MOD
	} STREAM_TYPE;

	typedef struct {
		DWORD			hStream;
		STREAM_TYPE		type;
	} STREAM_NODE;

	//  CSounds class
	class CSound {
	public:
		/// Constructor
		CSound(HWND		hwnd);

		/// Destructor
		~CSound();

		/// Initialize sound system
		bool		init(int	device,	DWORD freqs, DWORD flags);

		/// Deinitialize all
		void		deinitialize();

		/// Add a file to list
		/// \param	filename	: Filename
		/// \param	name		: The name we specify to use in list
		/// \param	flags		: BASS system flag
		bool			addFile(STREAM_TYPE type, string name, string filename, DWORD flag);

		/// Remove a sound.
		bool		remove(string name);

		/// Play a sound
		bool		play(string name, bool restart);

		/// Check if a sound is playing
		DWORD		getState(string name);

		/// Pause a sound
		bool		pause(string name);

		/// Stop sound
		bool		stop(string name);

		/// Pause all
		void		pauseAll();

		/// Stop all
		void		stopAll();

		/// Resume all
		void		resumeAll();

		/// Set volume value for an item
		void		setItemVolume(string name, int val);

		/// Set global volume
		void		setGlobalVolume(int val);

	private:
		/// Store all sounds
		map<string, STREAM_NODE>	m_sounds;

		HWND						m_hwnd;			// Window handle
		int							m_device;		// Device
		DWORD						m_freq;
		DWORD						m_flags;
	};
}


#endif